]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: add security icons to WEP/WPA wireless networks
authorDan Winship <danw@gnome.org>
Fri, 25 Mar 2011 15:27:56 +0000 (11:27 -0400)
committerDan Winship <danw@gnome.org>
Fri, 25 Mar 2011 22:55:40 +0000 (18:55 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=645647

data/theme/gnome-shell.css
js/ui/status/network.js

index 1ae4165780d6a63a4a34c3cb8c15eaf111dda340..e9aefb15a4d6a23aa01f0d3cdd402a2ce62be9c5 100644 (file)
@@ -185,6 +185,10 @@ StTooltip StLabel {
     background-image: url("toggle-on-intl.svg");
 }
 
+.nm-menu-item-icons {
+    spacing: .5em;
+}
+
 /* Panel */
 
 #panel {
index 189af80048186d15874f7ad9351f355e8bb86263..6b00e491c12a4d56d4e666b234bd3acba67a045b 100644 (file)
@@ -92,16 +92,32 @@ function NMNetworkMenuItem() {
 }
 
 NMNetworkMenuItem.prototype = {
-    __proto__: PopupMenu.PopupImageMenuItem.prototype,
+    __proto__: PopupMenu.PopupBaseMenuItem.prototype,
 
     _init: function(accessPoints, title, params) {
+        PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params);
+
         accessPoints = sortAccessPoints(accessPoints);
         this.bestAP = accessPoints[0];
 
         let ssid = this.bestAP.get_ssid();
         title = title || NetworkManager.utils_ssid_to_utf8(ssid) || _("<unknown>");
 
-        PopupMenu.PopupImageMenuItem.prototype._init.call(this, title, this._getIcon(), params);
+        this._label = new St.Label({ text: title });
+        this.addActor(this._label);
+        this._icons = new St.BoxLayout({ style_class: 'nm-menu-item-icons' });
+        this.addActor(this._icons, { align: St.Align.END });
+
+        this._signalIcon = new St.Icon({ icon_name: this._getIcon(),
+                                         style_class: 'popup-menu-icon' });
+        this._icons.add_actor(this._signalIcon);
+
+        if (this.bestAP._secType != NMAccessPointSecurity.UNKNOWN &&
+            this.bestAP._secType != NMAccessPointSecurity.NONE) {
+            this._secureIcon = new St.Icon({ icon_name: 'network-wireless-encrypted',
+                                             style_class: 'popup-menu-icon' });
+            this._icons.add_actor(this._secureIcon);
+        }
 
         this._accessPoints = [ ];
         for (let i = 0; i < accessPoints.length; i++) {
@@ -120,7 +136,7 @@ NMNetworkMenuItem.prototype = {
         if (strength > this.bestAP.strength)
             this.bestAP = ap;
 
-        this.setIcon(this._getIcon());
+        this._signalIcon.icon_name = this._getIcon();
     },
 
     _getIcon: function() {